<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<base href="../" />

<!-- oktavia -->
<link rel="stylesheet" href="assets/searchstyle.css" type="text/css" />
<script src="search/jquery-1.9.1.min.js"></script>
<script src="search/oktavia-jquery-ui.js"></script>
<script src="search/oktavia-english-search.js"></script>
<!-- /oktavia -->

<link rel="stylesheet" href="assets/style.css" type="text/css" />

<title>Status Directives - Configure - H2O - the optimized HTTP server</title>
</head>
<body>
<div id="body">
<div id="top">

<h1>
<a href="index.html">H2O</a>
</h1>
<p class="description">the optimized HTTP/1.x, HTTP/2, HTTP/3 server</p>

<!-- oktavia -->
<form id="searchform">
<input class="search" type="search" name="search" id="search" results="5" value="" placeholder="Search" />
<div id="searchresult_box">
<div id="close_search_box">&times;</div>
<div id="searchresult_summary"></div>
<div id="searchresult"></div>
<div id="searchresult_nav"></div>
<span class="pr">Powered by <a href="https://github.com/shibukawa/oktavia">Oktavia</a></span>
</div>
</form>
<!-- /oktavia -->

</div>

<table id="menu">
<tr>
<td><a href="index.html">Top</a></td>
<td><a href="install.html">Install</a></td>
<td class="selected"><a href="configure.html">Configure</a></td>
<td><a href="faq.html">FAQ</a></td>
<td><a href="http://blog.kazuhooku.com/search/label/H2O" target="_blank">Blog</a></td>
<td><a href="http://github.com/h2o/h2o/" target="_blank">Source</a></td>
</tr>
</table>

<div id="main">

<h2>
<a href="configure.html">Configure</a> &gt;
Status Directives
</h2>


<p>
The status handler exposes the current states of the HTTP server.
This document describes the configuration directives of the handler.
</p>

<ul>
<li><a href="configure/status_directives.html#status">
<code>status</code>
</a></li>
<li><a href="configure/status_directives.html#duration-stats">
<code>duration-stats</code>
</a></li>
</ul>


<div id="status" class="directive-head">
<div class="directive-since">since v2.0</div>
<h3><a href="configure/status_directives.html#status"><code>"status"</code></a></h3>
</div>

<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
If the argument is <code>ON</code>, the directive registers the status handler to the current path.

</p>

<p>
Access to the handler should be <a href="configure/mruby.html#access-control">restricted</a>, considering the fact that the status includes the details of in-flight HTTP requests.
The example below uses <a href="configure/basic_auth.html">Basic authentication</a>.
</p>
<div class="example">
<div class="caption">Example. Exposing status with Basic authentication</div>
<pre><code>paths:
  /server-status:
    mruby.handler: |
      require &quot;htpasswd.rb&quot;
      Htpasswd.new(&quot;/path/to/.htpasswd&quot;, &quot;status&quot;)
    status: ON
</code></pre>
</div>

<p>
The information returned by the <code>/json</code> handler can be filtered out using the optional <code>show=module1,module2</code> parameter.
There are currently three modules defined:
<ul>
<li><code>requests</code>: displays the requests currently in-flight.</li>
<li><code>durations</code>: displays durations statistics for requests since server start time in seconds (returns all zeros unless <code>duration-stats</code> is <code>ON</code>).</li>
<li><code>errors</code>: displays counters for internally generated errors.</li>
<li><code>main</code>: displays general daemon-wide stats.</li>
</ul>
</p>

</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>path</dd>
</dl>

<div id="duration-stats" class="directive-head">
<div class="directive-since">since v2.1</div>
<h3><a href="configure/status_directives.html#duration-stats"><code>"duration-stats"</code></a></h3>
</div>

<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Gather timing stats for requests.
</p>

</p>
<p>
If the argument is <code>ON</code>, this directive populates duration statistics in seconds, to be consumed by status handlers.
Enabling this feature has a noticeable CPU and memory impact.
</p>
<p>
Note that the time spent while processing a request in a blocking manner (such as opening a file or a mruby handler that does invoke a network operation) will not be reflected to the <code>process_time</code> element of the duration stats due to the fact that the timer being used for measuring the time spent is updated only once per loop.
</p>

</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
<dt>Default:</dt>
<dd><code><pre>duration-stats: OFF</pre></code>
</dl>






</div>
<div id="footer">
<p>
Copyright &copy; 2015-2023 <a href="http://dena.com/intl/">DeNA Co., Ltd.</a> et al.
</p>
</div>
</body>
</html>
